<?php

/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

/**
 * Description of Rule
 *
 * @author Jewel Tolentino
 */
class Rule extends Formalistics {

    //put your code here


    public $name;
    public $description;
    public $form;
    public $formula;
    public $actions;
    public $schedule_start_date;
    public $schedule_end_date;
    public $rep_data;
    public $date_created;
    public $is_active;

    public function __construct($db, $id) {
        $this->init($db, $id);
    }

    public function init($db, $id) {
        $this->db = $db;
        if ($id) {
            $result = $this->db->query("SELECT * FROM tbmiddleware_settings WHERE id = {$id}", "row");

            $this->id = $result["id"];
            $this->name = $result["rulename"];
            $this->description = $result["description"];
            $this->form = new Form($this->db, $result["formname"]);
            $this->formula = $result["formula"];
            $this->actions = $result["actions"];
            $this->schedule_start_date = $result["scheduled_process_start"];
            $this->schedule_end_date = $result["scheduled_process_end"];
            $this->rep_data = $result["schedule_rep_data"];
            $this->date_created = $result["date_created"];
            $this->is_active = $result["is_active"];
        }
    }

}
